#include "virmachineinfor.h"

VirMachineInfor* VirMachineInfor::_instance=nullptr;

VirMachineInfor* VirMachineInfor::GetInstance(QObject* parent){
    if(VirMachineInfor::_instance==nullptr)
        VirMachineInfor::_instance=new VirMachineInfor(parent);
    return VirMachineInfor::_instance;
}

VirMachineInfor::~VirMachineInfor(){

}

void VirMachineInfor::SubmitInfor(Yzty::ITEMCODE mcode,QVector<Yzty::BaceInfor*>& infors){
    std::lock_guard<std::mutex> glock(this->_mutex);
    this->_infors[mcode]=std::move(infors);
}

const QVector<Yzty::BaceInfor*>& VirMachineInfor::GetItemInfor(Yzty::ITEMCODE icode){
    std::lock_guard<std::mutex> glock(this->_mutex);
    return this->_infors[icode];
}

VirMachineInfor::VirMachineInfor(QObject* parent):QObject (parent){

}
